﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;

/// <summary>
/// 管线资源
/// </summary>
[CreateAssetMenu(menuName = "Rendering/Custom Render Pipeline")]
public class CustomRenderPipelineAsset : RenderPipelineAsset
{
    [SerializeField]
    bool useDynamicBatching = true, useGPUInstancing = true, UseSRPBatcher = true;

    [SerializeField]
    ShadowSettings shadowSettings = default;

    /// <summary>
    /// 何时会被调用
    ///     1. 编辑器下，创建一个新的管线实例时（通过脚本或编辑器工具）
    ///     2. 运行时，程序启动时
    ///     3. 切换管线时
    ///     4. 重新加载场景时
    /// </summary>
    /// <returns></returns>
    protected override RenderPipeline CreatePipeline()
    {
        Debug.Log("调用 CreatePipeline 方法!!!");
        var crp = new CustomRenderPipeline(useDynamicBatching, useGPUInstancing, UseSRPBatcher, shadowSettings);
        return crp;
    }
}
